﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using PersonalFinanceManager.Repositories.RefactoredEntities;

namespace PersonalFinanceManager.Repositories.Repositories
{
    public class BillsRepository : BaseRepository<DataModel.Bills>
    {
        public IList<BillsRefactored> GetCurrentMonthBills_Refactored(int userID)
        {
            var ctx = CreateContext();

            //var bills = ctx.Bills.Where(x => x.UserID == userID).OrderBy(x => x.Name);
            IList<BillsRefactored> bills = (from b in ctx.Bills.Where(x => x.UserID == userID)
                                            select new BillsRefactored
                                            {
                                                ID = b.ID,
                                                Name = b.Name,
                                                PreviousMonthBill = (decimal)0.0,
                                                CurrentMonthBill = (decimal)0.0
                                            }).ToList();

            return bills;
        }
    }
}